package com.spotalog.server.service.rest.exceptions;

import javax.inject.Singleton;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;
import javax.ws.rs.ext.Provider;

import com.spotalog.shared.exceptions.InvalidParameterException;

@Provider
@Singleton
public class InvalidParameterExceptionMapper implements ExceptionMapper<InvalidParameterException> {
	@Override
	public Response toResponse(InvalidParameterException exception) {
		return Response.status(Response.Status.BAD_REQUEST).entity(exception.getLocalizedMessage())
				.build();
	}
}
